home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / tcoop.arc / TCOOP2.ARC / MSGTST.CPP < prev    next >
Encoding:
C/C++ Source or Header  |  1991-10-26  |  1012 b   |  41 lines

  1. // msgtst.cpp: This program demonstrates how you can create a simple
  2. // dialog box--like those in QP--that displays help messages
  3.  
  4. #include "dialogue.h"
  5.  
  6. void PopupMsg(char *Str, MsgPkt &M)
  7. // Popup a dialog box
  8. {
  9.   MsgBox *MB;
  10.  
  11.   MB = new MsgBox(Str, 0x11, WindowStyle-BorderPrompt, InvColors);
  12.   MB->Open(FullScrn, (80-MB->Panel->Overall->Wd) / 2,
  13.                      (25-MB->Panel->Overall->Ht) / 2);
  14.   MB->SwitchFocus(M);
  15.   M.RtnCode = Idle; M.Code = Idle;
  16.   do {
  17.     MB->SubMgr->EventStep(M);
  18.     M.Code = M.RtnCode;
  19.   } while (M.Code != ShutDown &&
  20.            (!MB->Active || M.Code != Close || M.Focus != (Iso *)MB));
  21.   if (M.Code == Close) {
  22.      MB->OnClose(M);
  23.      M.RtnCode = Idle;
  24.   }
  25.   delete MB;
  26. }
  27.  
  28. Wso *W;
  29.  
  30. main()
  31. {
  32.   Setup(MouseOptional, CyanColors);
  33.   FullScrn->Panel->Clear(177, 0x07);
  34.   W = new Wso(0x11, WindowStyle, CyanColors);
  35.   W->SetSize(70,18);
  36.   W->Open(FullScrn,2,2);
  37.   PopupMsg("This is a test of the MsgBox type",StartMsg);
  38.   CleanUp();
  39. }
  40.  
  41.